Skip to content

Remove ClassSupportsIClassX which always returns true - #131683

Open
elinor-fung with Copilot wants to merge 2 commits into
mainfrom
copilot/clean-up-classsupportsiclassx
Open

Remove ClassSupportsIClassX which always returns true#131683
elinor-fung with Copilot wants to merge 2 commits into
mainfrom
copilot/clean-up-classsupportsiclassx

Conversation

Copilot AI commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

ClassSupportsIClassX was a stub that unconditionally returned TRUE, making all call sites either dead code or no-ops. Removes the function and simplifies the call sites.

  • interoputil.cpp / interoputil.h: Delete ClassSupportsIClassX function and declaration
  • comcallablewrapper.cpp: Remove always-true if (ClassSupportsIClassX(pMT)) guard; enum_SupportsIClassX is set unconditionally
  • class.cpp: Remove always-false if (!ClassSupportsIClassX(this)) return clsIfNone; dead code path in GetComClassInterfaceType

Co-authored-by: elinor-fung <47805090+elinor-fung@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/interop-contrib
See info in area-owners.md if you want to be subscribed.

@elinor-fung
elinor-fung marked this pull request as ready for review July 31, 2026 23:24
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@jkoritzinsky

Copy link
Copy Markdown
Member

@copilot can we remove enum_SupportsIClassX and adjust the code paths that check it to take the "is set" branch if it's set unconditionally?

Co-authored-by: jkoritzinsky <1571408+jkoritzinsky@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 31, 2026 23:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

Copilot AI commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

@copilot can we remove enum_SupportsIClassX and adjust the code paths that check it to take the "is set" branch if it's set unconditionally?

Done in commit that follows on this PR. Removed enum_SupportsIClassX and SupportsIClassX() entirely, and simplified all call sites to take the "is set" branch unconditionally:

  • GetBasicIP() now directly returns GetIClassXIP(inspectionOnly) (the rest of the function was dead code)
  • All if (pTemplate->SupportsIClassX()) / if (pIntfCCWTemplate->SupportsIClassX()) guards removed in comcallablewrapper.cpp, interoputil.cpp, and stdinterfaces.cpp
  • The two PRECONDITION(SupportsIClassX()) assertions removed from GetClassComMT() and CreateComMethodTableForClass()
  • The flag-setting pTemplate->m_flags |= enum_SupportsIClassX removed from CreateTemplate()

Note

This response was generated by GitHub Copilot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

5 participants